home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
diff.zip
/
DIFF.DOC
< prev
next >
Wrap
Text File
|
1986-03-11
|
4KB
|
117 lines
DIFF -- File comparator
Command Format:
diff <file1> <file2> <options>
Options:
-Alterations
-Match
-Resynch <n>
-Header "foo"
-Blanks
-Singlecase
Description:
Diff performs a comparison between two ASCII files, and lists the
differences on the console or to redirected output. The general form of
a difference listing is:
--------------------------------------- <line1>
some lines from the first file
--------------------------------------- <line2>
the corresponding lines from the second file
Several options are available for changing the way DIFF operates. They
are listed below.
-Match specifies that, rather than listing the differences as shown
above, lines that are the same in both files are to be listed. The
header line will specify the line numbers in file1 and file2, separated
by a comma.
-Alters specifies that the changed lines in file2 are to be listed.
The format of the listing is:
--------------------------------- <line1>
some lines inserted in second file
--------------------------------- <line2>, <line3>
some lines in second file replacing
lines from the first file.
The first header indicates that the lines which follow are inserted
before line #<line1> in the first file; the second shows that the
following lines replace <line2> through <line3> in the first file.
-Resynch <n> specifies that at least <n> matching lines are required
for DIFF to end a set of differing lines. The default is 3.
-Header "foo" says that "foo" is the string to print at the beginning
of a header line. The default is a string of dashes.
-Blank causes DIFF to treat all strings of blanks and tabs as if they
were single blanks, and to ignore trailing blanks and tabs on lines.
It is useful if two files have things aligned in different columns, but
are otherwise similar.
-Singlecase causes DIFF to treat lowercase characters the same as their
uppercase equivalents. By default, DIFF respects case differences.
Any option may be abbreviated to its first character.
Examples:
diff whosis.bak whosis.c
diff -match myfile herfile >duplines
diff oldfile newfile -single -resync 4
Diagnostics:
"Unknown option" -- An unrecognizable option appears on the command
line.
"-xxx option requires a value" -- The -Resync or -Header option was
specified without giving a value.
"Files have too many differences to compare." -- The two files had so
many contiguous lines without a match that DIFF ran out of memory.
"can't happen" -- DIFF detected an internal error condition. This
message should never appear.
Bugs:
Sometimes, DIFF loses its place in the files, and starts reporting some
outrageous group of differences or runs out of memory. If this
happens, the file generally has some group of three or more consecutive
lines that are identical but appear in the middle of a changed area.
If so, a larger value of "-resync" may help.
Equal lines in the middle of a region of differences are reported as
different. If the comparison doesn't break down, a smaller value of "-
resync" may edit these out.
Notes:
If the files have a large number of differences, DIFF may take quite a
while, apparently without disc activity, to find its place. If you are
expecting a large number of differences, don't worry; this is normal.
If you aren't expecting many differences, make sure that you're
comparing the correct pair of files.